<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript Let</title>
</head>
<body>
<h1>使用 let 声明变量</h1>

<p id="demo"></p>

<script>
  var x = 10;
  // Here x is 10
  {
    let x=2;
    // Here x is 2
  }
  document.getElementById("demo").innerHTML=x;
  // Here x is 10
</script>

</body>
</html>